home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / tools / c2latex.lha / c++2latex / fancyheadings.doc (.txt) < prev    next >
LaTeX Document  |  1993-08-08  |  9KB  |  179 lines

  1. eturn-Path: piet@cs.ruu.nl
  2. eceived: from unido.informatik.uni-dortmund.de
  3.     by gorbi.informatik.uni-dortmund.de id AA04891; Mon, 7 Oct 91 11:35:20 +0100
  4. eceived: from ruuinf.cs.ruu.nl 
  5.     by unido.informatik.uni-dortmund.de with SMTP (5.65+/UNIDO-2.0.4.d)
  6.     via EUnet for gorbi.informatik.uni-dortmund.de
  7.     id AA12353; Mon, 7 Oct 91 11:31:05 +0100
  8. eceived: from gnu.cs.ruu.nl by ruuinf.cs.ruu.nl with SMTP
  9.     (5.61+/IDA-1.2.8) id AA25657; Mon, 7 Oct 91 12:15:53 +0100
  10. eceived: by alchemy.cs.ruu.nl
  11.     (15.11/15.6) id AA20318; Mon, 7 Oct 91 11:34:15 -0100
  12. ate: Mon, 7 Oct 91 11:34:15 -0100
  13. From: Piet van Oostrum <piet@cs.ruu.nl>
  14. essage-Id: <9110071034.AA20318@alchemy.cs.ruu.nl>
  15. o: heitkoet (Joerg Heitkoetter)
  16. ubject: Re: Fancy Latex Headers - Please Help
  17. ewsgroups: comp.text.tex
  18. n-Reply-To: <3853@laura.UUCP>
  19. rganization: Dept of Computer Science, Utrecht University, The Netherlands
  20. ere is the (new) doc file for fancyheadings.sty:
  21. ere is a documentstylestyle option that allows you to customize your
  22. age headers and footers in an easy way. It combines features that were
  23. eparately available in other pagestyles, without introducing much
  24. omplexity. You can define:
  25.     - three-part headers and footers
  26.     - rules in header and footer
  27.     - headers and footers wider than \textwidth
  28.     - multiline headers and footers
  29.     - separate headers and footers for even and odd pages
  30.     - separate headers and footers for chapter pages
  31. o use this pagestyle, you must include the ``fancyheadings'' style
  32. ption in your \documentstyle, and issue the \pagestyle{fancy} command.
  33. he \pagestyle{fancy} command should be issued after any changes made to
  34. textwidth.
  35. he page layout will be as follows:
  36.         LHEAD          CHEAD          RHEAD
  37.         ----------------------------------- (rule)
  38.                  page body
  39.         ----------------------------------- (rule)
  40.         LFOOT           CFOOT          RFOOT
  41. he L-fields will be leftadjusted, the C-fields centered and the
  42. -fields rightadjusted.
  43. ach of the six fields and the two rules can be defined separately.
  44. imple use:
  45. he header and footer fields can be defined by commands \lhead{LHEAD}
  46. nd so on for the other fields. If the field depends on something in the
  47. ocument (e.g. section titles) you must in general use the \markboth and
  48. markright commands, otherwise a title may end on the wrong page. You
  49. an do this e.g. by redefining the commands \chaptermark, \sectionmark
  50. nd so on (see example below). The defaults for these marks are as in
  51. he standard pagestyles. The marks can be put into a header or footer
  52. ield by referencing \leftmark and \rightmark.
  53. ules in header and footer
  54. he thickness of the rules below the header and above the footer can be
  55. hanged by redefining the length parameters \headrulewidth (default
  56. .4pt) and \footrulewidth (default 0). These may be redefined by the
  57. setlength command. A thickness of 0pt makes the rule invisible.
  58. f you want to make more complicated changes, you have to redefine the
  59. ommands \headrule and/or \footrule.
  60. eaders and footers wider than \textwidth
  61. he headers and footers are set in a box of width \headwidth. The
  62. efault for this is the value of \textwidth. You can make it wider (or
  63. maller) by redefining \headwidth with the \setlength or \addtolength
  64. ommand. The headers and footers will stick out the page on the same
  65. ide as the marginal notes. For example to include the marginal notes,
  66. dd both \marginparsep and \marginparwidth to \headwidth (see also the
  67. xample below).
  68. ultiline headers and footers
  69. ach of the six fields is set in an appropriate parbox, so you can put a
  70. ultiline part in it with the \\ command. It is also possible to put
  71. xtra space in it with the \vspace command. Note that if you do this you
  72. ill probably have to increase the \headheight or \footskip lengths.
  73. eparate headers and footers for even and odd pages
  74. f you want the headers and footers to be different on even- and
  75. dd-numbered pages in the ``twoside'' style, the field-defining macros
  76. an be given an optional argument, to be used on the even-numbered
  77. ages, like \lhead[EVEN-LHEAD]{ODD-LHEAD}.
  78. eparate headers and footers for chapter pages
  79. aTeX gives a \thispagestyle{plain} command for the first page of the
  80. ocument, the first page of each chapter and a couple of other pages. It
  81. ight be incompatible with your pagestyle. In this case you can use a
  82. lightly different version of the pagestyle, called \pagestyle{fancyplain}. 
  83. his pagestyle redefines the pagestyle ``plain'' to also use pagestyle
  84. `fancy'' with the following modifications:
  85.     - the thicknesses of the rules is defined by \plainheadrulewidth and
  86.       \plainfootrulewidth (both default 0).
  87.     - the 6 fields may be defined separately for the plain pages by
  88.       giving them the value \fancyplain{PLAIN-VALUE}{NORMAL-VALUE}. This
  89.       construct may be used in both the optional argument and the normal
  90.       argument. Thus \lhead[\fancyplain{F1}{F2}]{\fancyplain{F3}{F4}}
  91.       specifies the LHEAD value in a two-sided document:
  92.     F1 on an even-numbered ``plain'' page
  93.     F2 on an even-numbered normal page
  94.     F3 on an odd-numbered ``plain'' page
  95.     F4 on an odd-numbered normal page.
  96. efaults:
  97. headrulewidth           0.4pt
  98. footrulewidth        0pt
  99. plainheadrulewidth    0pt
  100. plainfootrulewidth    0pt
  101. lhead[\fancyplain{}{\sl\rightmark}]{\fancyplain{}{\sl\leftmark}}
  102.   i.e. empty on ``plain'' pages \rightmark on even, \leftmark on odd pages
  103. chead{}
  104. rhead[\fancyplain{}{\sl\leftmark}]{\fancyplain{}{\sl\rightmark}}
  105.   i.e. empty on ``plain'' pages \leftmark on even, \rightmark on odd pages
  106. lfoot{}
  107. cfoot{\rm\thepage} % page number
  108. rfoot{}
  109. xamples:
  110. o put two lines containing the section title and the subsection title
  111. n the righthandside corner, use:
  112. documentstyle[fancyheadings]{article}
  113. pagestyle{fancy}
  114. renewcommand{\sectionmark}[1]{\markboth{#1}{}}
  115. renewcommand{\subsectionmark}[1]{\markright{#1}}
  116. rfoot{\leftmark\\\rightmark}
  117. he following definitions give an approximation of the style used in the
  118. aTeX book:
  119. documentstyle[fancyheadings]{book}
  120. pagestyle{fancyplain}
  121. addtolength{\headwidth}{\marginparsep}
  122. addtolength{\headwidth}{\marginparwidth}
  123. renewcommand{\chaptermark}[1]{\markboth{#1}{#1}} % remember chapter title
  124. renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
  125.                                                 % section number and title
  126. lhead[\fancyplain{}{\bf\thepage}]{\fancyplain{}{\bf\rightmark}}
  127. rhead[\fancyplain{}{\bf\leftmark}]{\fancyplain{}{\bf\thepage}}
  128. cfoot{}
  129. sing section titles etc. in the headers and/or footers:
  130. ou can't just change the header and/or footer fields in the middle of some
  131. ext (e.g. after a section header). This is because TeX may have processed
  132.  bit more text before deciding to make up the page. It may have passed a
  133. ection beginning, causing the wrong title on the page.  TeX has a
  134. echanism called 'marks' to solve this problem.  There is in LaTeX a
  135. leftmark and a \rightmark. Usually \leftmark is a chapter title and
  136. rightmark is a section title. To set the marks there are two commands:
  137. markboth{L}{R} sets the \leftmark to L and the rightmark to R, and
  138. rightmark{R} sets only the rightmark to R.
  139. he default definitions of \section etc. do this already for you.
  140. n example follows:
  141.     left page                        right page
  142.     ---------                        ----------
  143.          CHAPTER 1. Introduction | 1.2 Some section                        3
  144. ----------------------------------- | -----------------------------------------
  145.                                      |
  146. ext                                 | more text
  147. ext                                 | more text
  148. ext                                 | more text
  149.                                      |
  150.                                      |
  151.                                      |
  152. his can be easily done with fancyheadings as follows:
  153. pagestyle{fancy}
  154. setlength{\headrulewidth}{1pt}
  155. lhead[\rm\thepage]{\sl\rightmark}
  156. rhead[\sl\leftmark]{\rm\thepage}
  157. his specifies that on even pages (the [] parts) the leftheadpart is page
  158. umber and rightheadpart is \leftmark, which is the chapter title (because that
  159. s given as the left argument of \markboth (see page 162 of the LaTeX book)
  160. n odd pages (the parts between {}) the leftheadpart is \rightmark (which
  161. s the last section title because that is given as argument to \markright
  162. see the same page), and the rightheadpart is the page no.
  163. ow suppose you don't want the section number and you want the section
  164. itle in upper case:
  165. ou add the following to your preamble:
  166. renewcommand{\sectionmark}[1]{\markright{\uppercase{#1}}}
  167. r if you don't want the chapter number but only the chapter title (not in
  168. ppercase):
  169. renewcommand{\chaptermark}[1]{\markboth{#1}{ }}
  170. ote: the parameter in both cases is the (section|chapter) title.
  171. NOWN PROBLEMS:
  172. ometimes you will get a warning message from LaTeX concerning ``overfull
  173. box during output''. In this case you have to increase the \headheight or
  174. footskip lengths or both (with \addtolength or \setlength).
  175. iet* van Oostrum, Dept of Computer Science, Utrecht University,
  176. adualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
  177. elephone: +31 30 531806   Uucp:   uunet!mcsun!ruuinf!piet
  178. elefax:   +31 30 513791   Internet:  piet@cs.ruu.nl   (*`Pete')
  179.